import request from '@/utils/request'
// import qs from 'qs'

// 运行模式

// 切换运行模式
export function switchRunMode (params) {
  var data = fromData(params)
  return request({
    url: '/run/switchRunMode',
    method: 'post',
    data
  })
}

// 显示当前运行模式
export function getRunInfo (params) {
  var data = fromData(params)
  return request({
    url: '/run/getRunInfo',
    method: 'post',
    data
  })
}

// 设置测试模式下的参数选项
export function switchOpStatus (params) {
  var data = fromData(params)
  return request({
    url: '/run/switchOpStatus',
    method: 'post',
    data
  })
}

function fromData (params) {
  let formData = new FormData()
  for (const it in params) {
    if (!Object.is(params[it], null) && !Object.is(params[it], '')) {
      formData.append(it, params[it])
    }
  }
  return formData
}
